package com.pn.taikao.common;

/**
 * 响应状态码枚举
 */
public enum ResultCode {
    // 成功
    SUCCESS(200, "操作成功"),
    
    // 客户端错误 4xx
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权，请先登录"),
    FORBIDDEN(403, "没有权限访问"),
    NOT_FOUND(404, "资源不存在"),
    
    // 业务错误 5xx
    BUSINESS_ERROR(500, "业务处理失败"),
    PARAM_ERROR(501, "参数错误"),
    USERNAME_EXISTS(502, "用户名已存在"),
    EMAIL_EXISTS(503, "邮箱已存在"),
    LOGIN_FAILED(504, "用户名或密码错误"),
    USER_NOT_FOUND(505, "用户不存在"),
    
    // 系统错误
    SYSTEM_ERROR(999, "系统内部错误");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}

